#include "version.h"
#include "DeviceInfo.h"

static LocalMachineVersion stAppMachineVersion;

const LocalMachineVersion LclMchVers __attribute__ ((at(SYSTEMINFO_ADDR))) = {
	.sfv = {
		.SfVers = {1, 1, 0},
		.SfBuildVers = {1, 1, 0},
		.SfCompileDateTime = __DATE__";"__TIME__,
	},
	.hdv = {
		.HdVers = {1, 1, 0},
		.HdBuildVers = {1, 1, 0, 1, 1, 0},
		.HdProductDateTime = "20240308"
	},
	.pro_info = {
		.ProductNum = "XPandaBMSBootloader",
		.ProductName = "XPandaBMSBootloader"
	}
};

#if 1
#include <string.h>
#include "flash.h"
void GetLocalMachineVersion(LocalMachineVersion *lmv)
{
	memcpy(lmv, &LclMchVers, sizeof(LocalMachineVersion));
}

void InitAppMachineVersion(void)
{
	STMFLASH_Read(APPINFO_ADDR, (uint32_t *)&stAppMachineVersion, sizeof(LocalMachineVersion) / sizeof(uint32_t));
}

LocalMachineVersion* GetAppMachineVersion(void)
{
	return &stAppMachineVersion;
}
#endif
